package monitoreo;

/**
 * Estadisticas a recolectar
 *
 * @author Osvaldo Clua
 */
public class Estadistica {

    private String nombre;
    private long cantProc = 0; //cantidad de registros procesados
    private long t = 0; // tiempo transurrido
    private long tPause = 0; // tiempo en pausa
    private long cantPause = 0; //veces en pausa
    private long waitedCount = 0;  //cantidad de wait por recurso
    private long waitedTIme = 0;  // tiempo en wait
    private long instStart;  //instante de comienzo
    private long instStop;  //instate de final

    /**
     * @return the t
     */
    public long getT() {
        return t;
    }

    /**
     * @param t the t to set
     */
    public void setT(long t) {
        this.t = t;
    }

    /**
     * @return the tPause
     */
    public long gettPause() {
        return tPause;
    }

    /**
     * @param tPause the tPause to set
     */
    public void settPause(long tPause) {
        this.tPause = tPause;
    }

    /**
     * @return the cantPause
     */
    public long getCantPause() {
        return cantPause;
    }

    /**
     * @param cantPause the cantPause to set
     */
    public void setCantPause(long cantPause) {
        this.cantPause = cantPause;
    }

    /**
     * @return the nombre
     */
    public String getNombre() {
        return nombre;
    }

    /**
     * @param nombre the nombre to set
     */
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    /**
     * @return the waitedCount
     */
    public long getWaitedCount() {
        return waitedCount;
    }

    /**
     * @param waitedCount the waitedCount to set
     */
    public void setWaitedCount(long waitedCount) {
        this.waitedCount = waitedCount;
    }

    /**
     * @return the waitedTIme
     */
    public long getWaitedTIme() {
        return waitedTIme;
    }

    /**
     * @param waitedTIme the waitedTIme to set
     */
    public void setWaitedTIme(long waitedTIme) {
        this.waitedTIme = waitedTIme;
    }

    public String toString() {
        return (nombre + "start " + getInstStart() + ", stop " + getInstStop()
                +", "+cantProc+ " registros procesados\n"
                + " duracion " + t + ", pausa " + tPause
                +" ("+getCantPause()+" veces),"
                + "  " + waitedCount + " veces waiting "
                + " (" + waitedTIme + "ms)");
    }

    /**
     * @return the instStart
     */
    public long getInstStart() {
        return instStart;
    }

    public void setInstStart(long instStart) {
        this.instStart = instStart;
    }

    public long getInstStop() {
        return instStop;
    }

    public void setInstStop(long instStop) {
        this.instStop = instStop;
    }

    public void calcSS() {
        t = getInstStop() - getInstStart() - gettPause();
    }

    public long getCantProc() {
        return cantProc;
    }

    public void incCantProc() {
        this.cantProc++;
    }
}
